using UnityEngine;

public class SortLayerInGame : MonoBehaviour
{
	public string _name;

	public int index;

	private void Start()
	{
		if (GetComponent<LineRenderer>() != null)
		{
			GetComponent<LineRenderer>().sortingLayerName = _name;
			GetComponent<LineRenderer>().sortingOrder = index;
		}
		if (GetComponent<TrailRenderer>() != null)
		{
			GetComponent<TrailRenderer>().sortingLayerName = _name;
			GetComponent<TrailRenderer>().sortingOrder = index;
		}
		if (GetComponent<ParticleRenderer>() != null)
		{
			GetComponent<ParticleRenderer>().sortingLayerName = _name;
			GetComponent<ParticleRenderer>().sortingOrder = index;
		}
	}
}
